Guide:Adding new move effects outside battle
This tutorial gives a few hints on how new field effects of moves could be added, and how to copy existing ones for new moves. Adding new field effects The first thing I will say is very important indeed. If your new effect is at all similar to an existing field effect, look at how the existing one works and copy it. For example, Whirlpool works exactly the same as Cut, except the player can surf onto a whirlpool (at which point they will be thrown back). I can't stress enough how important this tip is, as it could save you a lot of trouble. If your new effect is really quite different, though, you need to decide how it'll work. All moves will always be able to be used from the party screen (even if circumstances aren't right, e.g. using Cut while not in front of a tree). Your move may also be usable in other ways too, e.g. interacting with an event. Once you know how your new effect will work, find a kind of effect listed in the page Using moves outside battle that best suits your new effect. Basically, wherever a move of that kind has scripts, you should have scripts too. You will most likely be wanting to add in a move effect that exists in the later Pokémon games. Below are tips on what to do for them. Examples Rock Climb * There are two basic ways to do Rock Climb - the first is to copy how Waterfall works, but use a new terrain tag ("rocky cliff") for its use. The scripts will contain all the move routes, and should keep moving the player until they are no longer standing on a "rocky cliff" tile. The direction the player moves in depends on the direction they are facing - if moving left/right, remember to also go up/down as well. You will need to come up with a way to decide whether the player should go up or down, likely by checking the terrain tags in particular places (diagonally up/down relative to the player) and set the move route accordingly. * The second way is to do it like side stairs currently work, i.e. put an event at either end of the "rocky cliff". These events check whether you meed the criteria for using Rock Climb, and if so, sets a move route. This is easier to do than the above, but you will need to make sure the move routes are correct for each event individually (i.e. move X tiles in X direction). It also lacks the ability to do fancy things like change the player's speed, shake the player around while they climb and display tumbling rocks animations. Whirlpool * As mentioned above, Whirlpool is just like Cut, except you can surf onto it (and when you do it knocks you back). The whirlpool itself will be an event placed on water, set to passable (i.e. the "Through" option is ticked). Add into the scripts an "Events.onStepTaken" procedure (like an "Events.onAction" procedure) that checks whether the player is standing on an event called "Whirlpool" - if they are, spin them around and set a move route back off it. The hardest part here is figuring out whether the player is standing on an event at all (checking its name is easy once you have that, though) - see how the def "pbFacingEvent" works and copy it to make something similar but which checks the player's current coordinates, not whatever's in front of them. Defog * Defog works just like Flash, except it modifies a map's fog rather than a special darkness sprite. By default, set foggy maps to have a fog upon entering them. When you use Defog, change the fog's opacity to 0 and then get rid of it (i.e. clear all the fog-related properties for that map). When deciding on what in-battle weather to have, check whether the player is in a listed map and there is a fog for that map - by listing these maps specially, you can have fogs on other maps that don't count as actual fog, e.g. showing sunshine rays, foliage shadows. Look at def command_204 and def command_206 in the script section Interpreter for how fogs are set and their opacities changed, and use similar scripts to handle what Defog actually does. Secret Power * Secret Power works just like Cut, except rather than deleting the event showing the indent/vines/grass, it sets that event's Self Switch A to ON. The second page of that event will depend on Self Switch A being ON, and will show an opening and will transfer the player to their secret base map. As is, this will allow for multiple secret bases, but you can instead reset the old entrance's Self Switch A when creating a new one to allow just one secret base at a time. This can be made to work several different ways. Giving multiple moves the same effect You may want to allow several different moves to do the same thing, e.g. let the moves Slash, Leaf Blade and Night Slash also do what Cut does. Rather than copy out all the Cut-related scripts again for each new move, you can instead put in the following modifications: def Kernel.pbCut if $DEBUG || $Trainer.badgesBADGEFORCUT movefinder=Kernel.pbCheckMove( ) if movefinder Kernel.pbMessage(_INTL("This tree looks like it can be cut down!\1")) if Kernel.pbConfirmMessage(_INTL("Would you like to cut it?")) speciesname=!movefinder ? $Trainer.name : movefinder.name Kernel.pbMessage(_INTL("{1} used }!",speciesname )) pbHiddenMoveAnimation(movefinder) return true end else Kernel.pbMessage(_INTL("This tree looks like it can be cut down.")) end else Kernel.pbMessage(_INTL("This tree looks like it can be cut down.")) end return false end Something similar should be done for the other existing moves. You may need to edit an "Events.onAction" procedure rather than a proper def as above. Basically, just find where the actual effect is handled (not the checks for whether the move could be used or not) and the use messages are shown, and add in the modifications in some way. You will also need to add in the following two lines of script, below the "CanUseMove" and "UseMove" handlers respectively for Cut (put them at the very bottom of the script section PokemonHiddenMoves for convenience): HiddenMoveHandlers::CanUseMove.copy(:CUT, ) HiddenMoveHandlers::UseMove.copy(:CUT, ) Obviously, the highlighted part will be a list of all the moves that can do what Cut does. These two extra lines allow the move to show up in the party screen menu and to be used from there. All new move effects should have some version of these two lines (just change the move names). Suggestions * You could modify Flash so that you can use it by pressing X at any time while in a dark map. Alternatively, when the player enters a dark map, a message pops up automatically to ask whether Flash should be used (use an autorun event on each dark map to pop the message up, and call a new script that does the checks and action). * You could forbid the use of Dive at certain points underwater (like on Hoenn's Route 124). The easiest way to do this is to allow the use of Dive only in the same places where it can be used above water (i.e. how the Gen 3 games do it). To do this, take the player's coordinates and find the terrain tag of the tile at those coordinates on the above water layer - if it is a Deep Water terrain tag, then you can surface there. This works easily because the above water layer and the underwater layer should be the same size and in the same positions. ** Forbidding surfacing in certain places doesn't make much sense if the only thing above is ocean. Be sure to map sensibly, and show that the parts where surfacing is forbidden are actually submerged underground tunnels.